<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <link rel="icon" href="images/favicon.ico">
  <link rel="stylesheet" href="/lib/layui-v2.6.3/css/layui.css" media="all">
  <link rel="stylesheet" href="/css/layuimini.css?v=2.0.4.2" media="all">
  <link rel="stylesheet" href="/css/themes/default.css" media="all">
  <link rel="stylesheet" href="/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
  <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
  <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
</head>
<body>
  <table id="demo" lay-filter="test"></table>
</body>
<script src="/lib/layui-v2.6.3/layui.js" charset="utf-8"></script>
<script src="/js/lay-config.js?v=2.0.0" charset="utf-8"></script>
<script>
  layui.use(['table'], function () {
    var $ = layui.jquery,
            form = layui.form,
            table = layui.table;


      //封装GetQueryString()方法来获取URL后面的value值
      function GetQueryString(name) {
          var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
          var r = window.location.search.substr(1).match(reg);
          if (r != null)
              return decodeURI(r[2]);
          return null;
      }
      var type= GetQueryString("name"); // "add"
      console.log("界面跳转获取值",type)
      $.ajax(
          {
              method:"POST",
              url:"/admin/select",
              DataType:"json",
              data:{
                  userName:type,
              }
          }
      ).done(function (res) {
          console.log(res)
          table.render({
              elem: '#demo',
              cols: [
                  [
                      {field: 'id', width: 80, title: 'ID', sort: true},
                      {field: 'userName', width: 80, title: '用户名'},
                      {field: 'phone', width: 80, title: '电话', sort: true},
                      {field: 'address', title: '地址', minWidth: 150},
                      {field: 'registerTime', width: 80, title: '注册时间', sort: true},
                      {field: 'remainder', width: 80, title: '账户余额'},
                      {field: 'member', width: 135, title: '用户级别', sort: true},
                  ]
              ],
              data:res.data
              ,even: true
          });
      })
  })
</script>
</html>